import datetime
from tortoise.models import Model
from tortoise import fields


class Power(Model):
    id = fields.IntField(pk=True)
    name = fields.CharField(max_length=255, description="权限名称")
    type = fields.CharField(max_length=1, description="权限类型")
    code = fields.CharField(max_length=30, description="权限标识")
    url = fields.CharField(max_length=255, description="权限路径", null=True)
    open_type = fields.CharField(max_length=10, description="打开方式", null=True)
    parent_id = fields.IntField(description="父类编号", default=0)
    icon = fields.CharField(max_length=128, description="图标", null=True)
    sort = fields.IntField(description="排序", default=0)
    create_time = fields.DatetimeField(auto_now_add=True, description="创建时间")
    update_time = fields.DatetimeField(auto_now=True, description="更新时间")
    enable = fields.IntField(description="是否开启", default=1)

    class Meta:
        table = "admin_power"
